package Test4;

public class GirlFriendTest {
    public static void main(String[] args) {
        GirlFriend[] arr = new GirlFriend[4];
        GirlFriend g1 = new GirlFriend("小诗诗", 18, "萌妹子", "吃零食");
        GirlFriend g2 = new GirlFriend("小丹丹", 19, "笨妹子", "玩游戏");
        GirlFriend g3 = new GirlFriend("小猪猪", 20, "呆妹子", "睡觉");
        GirlFriend g4 = new GirlFriend("小丫丫", 21, "憨妹子", "锻炼");
        arr[0] = g1;
        arr[1] = g2;
        arr[2] = g3;
        arr[3] = g4;
        int sum = 0,avg = 0,count = 0;
        for (int i = 0; i < arr.length; i++) {
            GirlFriend girlFriend = arr[i];
            sum += girlFriend.getAge();
        }
        avg = sum / arr.length;
        for (int i = 0; i < arr.length; i++) {
            GirlFriend girlFriend = arr[i];
            if(girlFriend.getAge() <= avg){
                count++;
                System.out.println(girlFriend.getName() + ", " + girlFriend.getAge() + ", "
                 + girlFriend.getGender() + ", " + girlFriend.getHobby());
            }
        }
        System.out.println(count + "个");
    }
}
